home *** CD-ROM | disk | FTP | other *** search
- /* This script does a simple disassemble of the spectrum's memory, */
- /* starting at address 0. Is a very simple example of usage of */
- /* the ARexx ZXAMDisassemble() function */
-
- /* check if the emulator is there... */
- address command
-
- if ~show(ports,ZXAM_REXX) then do
- requestchoice 'title "ZXAM Script error..." body "I can't find the emulator's port!!" gadgets "AARGH!"'
- exit
- end
-
- /* store the initial status of the emulator */
- running=zxamactrun() /* 1=running */
- zxamstop() /* stop the emulation */
-
- /* open the output window */
- if ~open('fichero','con:0/11/640/200/Example of usage of ZXAMDisassemble()','W') then exit
-
- dir=0
-
- do forever
-
- do i=1 to 20 /* disassemble 20 lines */
- linea=zxamdisassemble(dir,'d') /* disassemble decimal */
- dummy=writech('fichero',substr(linea,2))
- dummy=writech('fichero','0a'x)
- dir=(dir+left(linea,1)) /* add the size of instruction */
- if dir>65535 then dir=dir-65536
- end i
-
- /* must we continue? */
- requestchoice '>t:zxamdisassem.tmp "ZXAM disassemble..."' '"Continue disassemble?"' GADGETS "OK|CANCEL"
- respuesta=zxampploadfile('t:zxamdisassem.tmp')
- respuesta=left(respuesta,length(respuesta)-1) /* delete the LF */
- if respuesta=0 then signal cleanup
-
- end
-
- cleanup:
-
- dummy=close('fichero')
-
- /* restore the status */
- if running=1 then zxamrun()
-
- exit
-